package ui;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;

import each_class.RanKingClass;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseTrackAdapter;


public class MusicListViewItem extends Composite {

	public MusicListViewItem(Composite parent, RanKingClass musicList) {
		super(parent, SWT.NONE);
		setBounds(0, 0, 256, 300);
		MusicList cover = new MusicList(this, musicList);
		cover.setBounds(0, 10, 256, 256);
		Label musicListName = new Label(this, SWT.CENTER);
		musicListName.setBounds(0, 270, 256, 27);
		if(musicList.getRanKingClass_name() != null)
		musicListName.setText(musicList.getRanKingClass_name());
		musicListName.addMouseTrackListener(new MouseTrackAdapter() {
			@Override
			public void mouseEnter(MouseEvent e) {
				musicListName.setForeground(ui.global.UIColor.GREEN);
			}
			@Override
			public void mouseExit(MouseEvent e) {
				musicListName.setForeground(ui.global.UIColor.DARK);
			}
		});
		musicListName.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseUp(MouseEvent e) {
				//TODO
				ui.global.Operation.search(musicListName.getText());
			}
		});
	}
}
